import request from "@/utils/request";

export function login(data: userLoginType): Promise<IResponse<LoginInfoType>> {
  return request({
    url: "/login/sms",
    method: "POST",
    data,
  });
}
export function sendSms(data: smsFace): Promise<IResponse<{}>> {
  return request({
    url: "/sms/login0",
    method: "POST",
    data,
  });
}

export function infos(params: any): Promise<IResponse<userInfoFace>> {
  return request({
    url: "/user/getUserInfo",
    method: "GET",
    params,
  });
}
interface wxLoginSuccessFace{
  token:string
}

// 微信登录
export function wxLogin(
  data: wxLoginFace
): Promise<IResponse<wxLoginSuccessFace>> {
  return request({
    url: "/login/mini",
    method: "POST",
    data,
  });
}

// 微信手机号登录
export function wxPhoneLogin(
  data: wxLoginFace
): Promise<IResponse<wxLoginSuccessFace>> {
  return request({
    url: "/user/bindphone",
    method: "POST",
    data,
  });
}

export function info(): Promise<IResponse<userInfoFace>> {
  return request({
    url: "/user/info",
    method: "get",
  });
}
